import React, { useEffect } from 'react'
// import { useState } from 'react'

const EffectTest = () => {
    // const [num, setNum] = useState(0)

    // setTimeout(() => {
    //     setNum(num + 1)
    // }, 1000)

    // useEffect(() => {
    //     if(num === 0) return
    //     console.log('componentDidMount', num)
    //     return () => {
    //         console.log('componentWillUnmount')
    //     }
    // }, [num])

    const getData = async () => {
        await 4
        console.log(4)
    }

    const handleClick = () => {
        getData()
    }

    useEffect(() => {
        getData()
    }, [])

    return (
        <div>
            <button onClick={handleClick}>getData</button>
        </div>
    )
}

export default EffectTest
